<style>
	.close {
		display: block;
		float: right;
		font-size: 21px;
		font-weight: 700;
		line-height: 1;
		opacity: 1;
		text-shadow: none;
		color: #fff;
	}
</style>
<div class="upload">
	<div id="del-list"></div>
	<div id="voice_list">
		{foreach name="voices" item="item"}
		<div>
			<input type="text" name="voice_edit[{$item.id}][title]" value="{$item.title}" placeholder="标题"/>
			<input type="file" name="voice_edit_{$item.id}" value="{$item.path}" />
			<p class="show-path">{$item.path}</p>
			<textarea name="voice_edit[{$item.id}][description]" id="ueditor-{$item.id}" class="word_editor ueditor-voice">{$item.description??''}</textarea>
			<a href="javascript:;" style="float: left" class="close btn btn-danger btn-sm" onclick="addDelList({$item['id']});forClose(this);">删除</a>
		</div>
		<br>
		<hr>
		{/foreach}
	</div>
	<div><a href="javascript:void(0);" id="forAdd">添加语音</a></div>
</div>
<script type="text/javascript">
	$(document).ready(function(){
		var i = 0;
		$("#forAdd").click(function(){
			var html = '<div>';
			html += '<input type="text" name="voice['+i+'][title]" placeholder="标题"/>';
			html += '<input type="file" name="voice_'+i+'" />';
			html += '<textarea name="voice['+i+'][description]" id="ueditor2-'+i+'" class="word_editor"></textarea>';
			html += '<a href="javascript:;" style="float: left" class="close btn btn-danger btn-sm" onclick="forClose(this);">删除</a>';
			html += '</div><br><hr>';
			$("#voice_list").append(html);
            var ue = UE.getEditor('ueditor2-'+i);
            i++;
		});
	});
    function forClose(obj) {
        $(obj).parent().remove();
    }
    function addDelList(id) {
		var html = '<input type="hidden" name="voice_del[]"  value="'+id+'">';
		$("#del-list").append(html);
    }

</script>
